package com.xs.shop.marketing.service.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xs.shop.marketing.model.entity.Coupon;
import com.xs.shop.marketing.model.vo.CouponInfoVO;
import com.xs.shop.marketing.model.vo.CouponPageQueryVO;
import com.xs.shop.marketing.model.vo.UserCouponVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xs
 * @since 2025-07-16
 */
@Mapper
public interface CouponMapper extends BaseMapper<Coupon> {
    /**
     * 查询用户优惠券
     * @param memberId 用户ID
     * @param status 优惠券状态，可为null
     * @return 结果
     */
    List<CouponPageQueryVO> pageQueryUserCoupons(
            @Param("memberId")Long memberId,
            @Param("status")Integer status);

    UserCouponVO getUserCoupon(
            @Param("memberId")Long memberId,
            @Param("couponId")Long couponId);

    Integer deleteMemberCoupon(
            @Param("memberId")Long memberId,
            @Param("couponId")Long couponId);

    Integer updateMemberCouponStatus(
            @Param("status")Integer status,
            @Param("updatedAt")LocalDateTime updatedAt,
            @Param("memberId")Long memberId,
            @Param("couponId")Long couponId);

    List<CouponInfoVO> couponInfoListQuery(
            @Param("memberId")Long memberId);

    Integer giveMemberCoupon(
            @Param("memberId")Long memberId,
            @Param("couponId")Long couponId,
            @Param("activityId")Long activityId,
            @Param("status")Integer status);
}
